<template>
	<view class="page">
		<!-- 标题栏 start -->
		<fu-custom :isBack="true" bgColor="bg-white" class="header" :isBottom="true">
			<block slot="content">{{ i18n['注销账号'] }}</block>
			<block slot="right">
			</block>
		</fu-custom>
		<view class=" padding-lr">
			<view class="padding-tb fu-fs32 ">{{ i18n['账号注销'] }}</view>
			<view class="wrap text-df text-666">{{ i18n['永久注销且无法恢复，请谨慎操作'] }}</view>
			<view class="padding-tb text-lg ">{{ i18n['账号注销后将放弃以下权益'] }}</view>
			<view class=" text-666 text-df">
				1、账号信息、第三方授权信息将被清空且无法恢复。
				2、账号相关信息将会一并被删除且无法恢复。
				3、注销后手机号码可重新注册，所生成账号为全新的账号，不包含注销账号的任何信息。
			</view>
			<view class="margin-top-300">
				<view class=" text-df text-sm margin-top-30 text-center text-999">{{ i18n['点击下方按钮，即表示你已阅读并了解以上风险'] }}
				</view>
				<view class="login-btn" @click="handleNext">
					{{ i18n['我已清楚风险，确定继续'] }}
				</view>
				<view class="login-btn1" @click="backPage">
					{{ i18n['返回'] }}
				</view>
			</view>

		</view>
		<!-- 断网监测 start -->
		<fu-notwork></fu-notwork>
		<!-- 断网监测 end -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				cancelObj: {
					//订单取消对象
					current: -1, //当前原因索引
					id: null, //当前id

				},
				types: '', //类型
				reasonList: [],
				checked: false,
				argument: '', //理由
				reason: '', //原因
			}
		},
		onLoad(e) {
			this.argument = e.argument
			this.reason = e.reason
		},
		computed: {
			// 用户信息
			userInfo() {
				return this.$store.getters.userInfo;
			}
		},
		methods: {
			onChangeReson(item, index) {
				if (this.cancelObj.current == index) return false;
				this.cancelObj.current = index;
				this.cancelObj.id = item.id;
			},
			backPage(){
				uni.navigateBack()
			},

			handleNext() {
				uni.showModal({
					title: '',
					content: '请再次确认，你已了解注销风险，并要继续执行该操作',
					confirmColor: '#FF4848',
					success: (res) => {
						if (res.confirm) {
							this.$api.post(global.apiUrls.cancelAccountSub, {
								unset_type:this.reason,
								unset_reason:this.argument
							}).then(res => {

								if (res.data.code == 1) {
									uni.redirectTo({
										url: '../cancel-success/index'
									})
									uni.$emit('cancelAccount')
								} else {
									//  其他情况错误码
									uni.showToast({
										title: res.msg,
										icon: 'none'
									});
								}
							})

						}
					}
				})
			}
		},
	}
</script>

<style lang="scss">
	page {
		height: 100%;
		background: #ffffff;
	}

	.content {
		min-height: 800rpx;
	}

	.agreement {
		display: flex;
		width: 100%;
		font-family: PingFangSC-Regular;
		font-size: 28rpx;
		color: #666666;
		align-items: center;
		justify-content: center;
		margin-bottom: 30rpx;

		.image {
			height: 28rpx;
			width: 28rpx;
			margin-right: 12rpx;
		}

		text {
			color: #FFA133;
		}
	}

	.login-btn {
		height: 88rpx;
		line-height: 88rpx;
		background: $bgtheme;
		border-radius: 80rpx;
		margin: 40rpx 0 0;
		font-size: 32rpx;
		color: #FFFFFF;
		text-align: center;
	}

	.login-btn1 {
		height: 88rpx;
		line-height: 88rpx;
		background-color: #EEEEEE;
		border-radius: 70rpx;
		margin: 30rpx 0 0;
		font-size: 32rpx;
		color: $bgtheme;
		text-align: center;
	}

	.checkbox-list {
		padding: 20rpx 15rpx;
	}

	.item {
		padding-bottom: 32rpx;

		.item-img {
			width: 32rpx;
			height: 32rpx;
		}

		.item-label {
			margin-left: 10rpx;
		}
	}

	.textarea-box {
		width: 100%;
		height: 272rpx;
		border: 1px solid #CCCCCC;
		border-radius: 6rpx;
		box-sizing: border-box;
		padding: 20rpx;
		color: #333333;
		font-size: 28rpx;
	}
</style>
